package cn.edu.scau.cmi.yangzemin.adapter;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class MyController {
	@FXML     
	private Button button;
	@FXML
	private TextArea area;
	@FXML
	private TextField num;
	@FXML
	private TextField name;
	@FXML
	private void initialize() {}
	@FXML 
	private void eventAction(ActionEvent event) {

		int Num=Integer.parseInt(num.getText());
		String Name=name.getText();

		Student stu=new Student();
		
		stu.setName(Name);
		stu.setId(Num);
		
		TheAdapterOfTheClass.stuList.add(stu);
		TheAdapterOfTheObject.students.add(stu);
		 
		Target theAdapterOfTheClass=new TheAdapterOfTheClass();
		Target theAdapterOfTheObject=new TheAdapterOfTheObject();
		
//		TheAdapterOfTheClass.stuList=theAdapterOfTheClass.sortStudent(TheAdapterOfTheClass.stuList);
		area.clear();
//		 for(Student list:TheAdapterOfTheClass.stuList) {
//			 area.appendText("ID = "+list.getId()+" , Name ="+list.getName()+"\n");
//		 }
		 	 
		 theAdapterOfTheObject.sortStudent(TheAdapterOfTheObject.students);
			 for(Student list:TheAdapterOfTheObject.students) {
				 area.appendText("ID = "+list.getId()+" , Name ="+list.getName()+"\n");
		}
	}		 
}